package com.cmseducation.controller;

import com.cmseducation.entity.EduCourse;
import com.cmseducation.service.IEduCourseService;
import com.cmseducation.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 课程 前端控制器
 * </p>
 *
 * @author Mr.Tang
 * @since 2022-05-01
 */
@CrossOrigin
@RestController
@RequestMapping("/cmseducourse")
public class EduCourseController {

    @Autowired
    IEduCourseService iEduCourseService;
    /*
    *查询热门课程
     */
    @Cacheable(value = "hotCourse",key = "'banner'")
    @GetMapping("gethotcourse")
    public R getHotCourse(){
        List<EduCourse> hotCourse = iEduCourseService.getHotCourse();
        return R.ok().data("hotCourse",hotCourse);
    }

}
